package org.swim.core.entities;

// Generated Dec 13, 2012 5:05:33 PM by Hibernate Tools 3.4.0.CR1

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.swim.remote.entities.INotification;

/**
 * Notification generated by hbm2java
 */
@Entity
@Table(name = "Notification", catalog = "jboss")
public class Notification implements java.io.Serializable, INotification {

	private static final long serialVersionUID = 1L;

	private NotificationId id;
	private Date timestamp;
	private Integer receiverdId;
	
	public Notification() {
	}

	public Notification(NotificationId id) {
		this.id = id;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "id", column = @Column(name = "id", nullable = false)),
			@AttributeOverride(name = "type", column = @Column(name = "type", nullable = false, length = 10))})
	public NotificationId getId() {
		return this.id;
	}

	public void setId(NotificationId id) {
		this.id = id;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "ts", nullable = false, length = 19)
	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}

	@Column(name = "receiverId", nullable = false)
	public Integer getReceiverdId() {
		return receiverdId;
	}

	public void setReceiverdId(Integer receiverdId) {
		this.receiverdId = receiverdId;
	}

	@Transient
	public NotificationStatus getNotificationStatus() {
		return NotificationStatus.UNREAD;
	}

	@Transient
	public String getNotificationType() {
		return getId().getType();
	}
	
}
